<template>
	<view style="overflow-x: hidden;">
		
		<!--医美专区-->
		<view class="wanlpage-banner">
			<swiper class="screen-swiper square-dot" 
			:indicator-dots="true" 
			:circular="true" 
			:autoplay="true" 
			interval="2800" 
			duration="500">
				<swiper-item v-for="(image, keys) in data.banner" :key="keys">
					<image :src="image" mode="aspectFill"></image>
				</swiper-item>
			</swiper>
		</view>
		
		
		<!-- <view class="recommend-product">
			<view class="recommend-line"></view>
			<view class="recommend-title2">礼包专区</view>
			<view class="recommend-line"></view>
		</view> 
		
		<view class="product-list">
			<view class="product-item" 
			v-for="(item,index) in data.lbzq_good" 
			:key="index"
			@tap="onGoods(item.id)"
			>
				<image :src="$wanlshop.oss(item.image, 125, 125)" mode="aspectFill" class="product-image"></image>
				<view class="product-title text-cut">{{item.title || ''}}</view>
				<view class="product-price">{{item.price || 0}}</view>
			</view>
		</view>
		 -->
		
		<view class="hot-box">
			<image src="/static/images/index/hot_bg.png" class="hot-image"></image>
			<view class="hot-content-box">
				<view class="hot-title-main">礼包专区</view>
				
				<view class="hot-body">
					<view class="hot-item" 
					 v-for="(item,index) in data.lbzq_good"
					 :key="index"
					 @click="onGoods(item.id)"
					 >
						<image :src="item.image" class="hot-shop-image"></image>
						<view class="hot-title">{{item.title || ''}}</view>
						<view class="hot-price">{{item.price || '0'}}</view>
					</view>
				</view>
			</view>
			
			<!-- <view class="hot-btn-boxs">
				<view class="hot-btn" @click="handleShop(lbzqData.shop_id, lbzqData.id, '礼包专区')" >
					<view class="hot-more-product">查看更多商品</view>
					<image src="/static/images/right.png" class="right-iamge"></image>
				</view>
			</view> -->
		 </view>
		 
		 
		<view class="video-box" v-if="data.qt_video">
			 <video :src="data.qt_video" 
			 class="video_style"
			 autoplay
			 muted
			 loop
			 :controls="false"
			 @click="screenVideo(data.qt_video, 0, 0)"
			 ></video>
		 </view>

		<view class="about-title-box">
			<view class="about-title-title">关于{{data.name_short}}</view>
			<view class="flex align-center" @click="$wanlshop.to('/pages/new/yimeiLists?category_id='+data.article.category_id+'&title=关于'+data.name_short)">
				<text class="about-more">查看更多</text>
				<view class="wlIcon-fanhui2 colorgrey"></view>
			</view>
		</view>
		
		<view class="about-box" @tap="onDetails(data.article.data.id, data.article.data.title)">
			<view class="about-left">
				<image :src="data.article.data.image"  class="about-image"></image>
			</view>
			<view class="about-right">
				<view class="about-title text-cut">{{data.article.data.title || ''}}</view>
				<view class="about-content text-cut-3">{{data.article.data.description || ''}}</view>
			</view>
		</view>	
		
		
		<view class="recommend-product">
			<view class="recommend-line"></view>
			<view class="recommend-title2">热销产品</view>
			<view class="recommend-line"></view>
		</view> 
		
		<wanl-product :dataList="data.hotsale_good" />
		
		<view v-if="videoPlay">
		    <video
		         controls
				 autoplay
		         id="fullVideo"
		         :src="videoUrl"
		         @fullscreenchange="screenChange"
		         :vslide-gesture-in-fullscreen="false"
				class="fullVideo"
		      ></video>
		</view>
		
		
	</view>
</template>

<script>
import wanlProduct from '@/components/wanl-product/wanl-product';

export default {
	components: {
		wanlProduct
	},
	data() {
		return { 
			data: [],
			videoUrl:'',
			videoPlay:false,
		}
	},
	onLoad() {
		this.loadData();
	},
	methods: {
		screenVideo(url, width, height){
			this.videoUrl = url;
			this.videoPlay = true;
		    let ratio = width > height ? 90 : 0;
		    this.videoContext = uni.createVideoContext("fullVideo", this);
		    this.videoContext.requestFullScreen({ direction: ratio });  
		    this.videoContext.play();
		},
		async loadData() {
			await uni.request({
				url: '/index/qtindex',
				method: 'GET',
				data: {
				},
				success: res => {
					this.data = res.data;
					console.log(this.data);
					this.data.name_short = res.data.name.replace('专区', '');
					
					uni.setNavigationBarTitle({
						title: data.name,
					})
				}
			});
		},
		handleShop(shopId, category_id, category_name) {
			this.$wanlshop.to(
				`/pages/shop/product/list?shop_id=${shopId}&category_id=${category_id}&category_name=${category_name}`
			);
		},
	}
}		
</script>



<style scoped lang="scss">
.wanlpage-banner{
	color: rgb(0, 0, 0);
	margin: 8px 12.5px 0px;
	border-radius: 11px;
	overflow: hidden;
}	

.screen-swiper{
	height: 165px;
}

.recommend-product{
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 42rpx;
	margin-bottom: 33rpx;
}

.recommend-line{
	width: 119rpx;
	height: 2rpx;
	border: 2px solid #366BEB;
}

.recommend-title2{
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 700;
	color: #333333;
	margin-left: 31rpx;
	margin-right: 31rpx;
}	

.product-list{
	display:flex;
	flex-wrap: wrap;
	justify-content: space-between;
	margin-left: 24rpx;
	margin-right: 24rpx;
	margin-top: 20rpx;
}

.product-item{
	width: 341rpx;
	background: #FFFFFF;
	border-radius: 20rpx;
	margin-bottom: 33rpx;
	padding-bottom: 20rpx;
}

.product-image{
	width: 341rpx;
	height: 341rpx;
	border-top-left-radius: 20rpx;
	border-top-right-radius: 20rpx;
}

.product-title{
	font-size: 26rpx;
	font-family: PingFang SC;
	font-weight: 700;
	color: #333333;
	margin-top: 20rpx;
	padding-left: 20rpx;
}

.product-price{
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 700;
	color: #F53938;
	margin-top: 20rpx;
	padding-left: 20rpx;
}

.about-box{
	width: 702rpx;
	height: 232rpx;
	background: #FFFFFF;
	border-radius: 20rpx;
	margin-top: 20rpx;
	margin-left: 24rpx;
	display: flex;
	padding: 16rpx;
}
	
.about-image{
	width: 240rpx;
	height: 200rpx;
	border-radius: 20rpx;
	margin-right: 29rpx;
}

.about-title{
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 700;
	color: #333333;
}

.about-content{
	font-size: 26rpx;
	font-family: PingFang SC;
	font-weight: 400;
	color: #808080;
	line-height: 40rpx;
	margin-top: 20rpx;
}

.about-title-box{
	margin-left: 30rpx;
	margin-right: 30rpx;
	margin-top: 20rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.about-title-title{
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 700;
	color: #333333;
}	
	
.about-more{
	color: #9c9c9c;
}

.colorgrey{
	color: #9c9c9c;
}

.hot-image{
	width: 702rpx;
	height: 525rpx;
	margin: 0rpx 24rpx;
}

.hot-title-main{
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 700;
	color: #FFFFFF;
	padding: 37rpx 0rpx 31rpx 29rpx;
}
	
.hot-box{
	position: relative;
	margin-top: 20rpx;
	margin-bottom: 20rpx;
}
	
.hot-content-box{
	position: absolute;
	top: 0rpx;
	left: 0rpx;
	width: 100%;
	margin: 0rpx 24rpx;
}

.hot-shop-image{
	width: 139rpx;
	height: 171rpx;
	margin-top: 22rpx;
}

.hot-title{
	font-size: 26rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #333333;
	margin-top: 41rpx;
}

.hot-price{
	font-size: 24rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #F53938;
	margin-top: 13rpx;
	padding-bottom: 20rpx;
}

.hot-item{
	width: 214rpx;
	height: 311rpx;
	background: #FFFFFF;
	border-radius: 20rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-right: 12rpx;
	flex-shrink: 0;
}

.hot-body{
	padding-left: 12rpx;
	width: 100%;
	display: flex;
	overflow-x: scroll;
	width: 702rpx;
}

.hot-more-product{
	font-size: 26rpx;
	font-family: PingFang SC;
	font-weight: 400;
	color: #FFFFFF;
	margin-right: 6rpx;
}

.right-iamge{
	width: 24rpx;
	height: 24rpx;
	border-radius: 50%;
}

.hot-btn{
	width: 224rpx;
	height: 52rpx;
	border: 2px solid #FFFFFF;
	border-radius: 26rpx;
	display:flex;
	align-items: center;
	justify-content: center;
	margin-top: 30rpx;
}

.hot-btn-boxs{
	position: absolute;
	bottom: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
}

.video-box{
	position: relative;
	margin: 20rpx 24rpx 30rpx 24rpx;
}

.video_style{
	width: 100%;
	height: 400rpx;
}
	
</style>